﻿// -----------------------------------------------------------------------
// <copyright file="FrameworkTests.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnitTestBase;
using SampleApp;
using NUnit.Framework;
namespace SampeAppTests
{

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class FrameworkTests : NUnitTestBase<UtilityServices>
    {
        protected override UtilityServices CreateComponent()
        {
            return new UtilityServices();
        }

        [Test]
        public void CanCreateComponent()
        {
            Component.SomeProperty = "for test";
            CleanTestData += new TestCleanUpNotification(FrameworkTests_CleanTestData);
            Assert.IsNotNull(Component);
        }
        /// <summary>
        /// Custom cleanup for test CanCreateComponent.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="arg">TestCleanUpNotificationData.</param>
        private void FrameworkTests_CleanTestData(object sender, TestCleanUpNotificationData arg)
        {
            if (arg.TestMethodName == "CanCreateComponent")
            {
                Component.SomeProperty = "clean this data";
            }
        }

        /// <summary>
        /// Cleanup Test class Data.
        /// </summary>
        protected override void DisposeBase()
        {
            base.DisposeBase();

            this.CleanTestData -= new TestCleanUpNotification(FrameworkTests_CleanTestData);
        }
    }
}
